package pro.cherish.knowledgedemovalid.service;

import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import pro.cherish.knowledgedemovalid.vo.TestVO;
import pro.cherish.knowledgedemovalid.vo.TestVO2;

import javax.validation.Valid;

/**
 * fixme 在检验service方法上，必须在类上打上@validated注解，否则方法中的额@valid不会生效
 */
 @Validated
// @Valid  不行，没效果
@Service
public class UserServiceImpl implements UserService {

    @Override
    public void testServieValid(@Valid TestVO testVO){
        System.out.println(testVO);
    }

    @Override
    public void testServieValid2(@Valid TestVO2 testVO2) {
        System.out.println(testVO2);
    }
}
